﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Register2.aspx.vb" Inherits="Register2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .auto-style1 {
            height: 29px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class ="center">
    <table style="width:70%;border-collapse: collapse;">
        <tr>
            <td class="auto-style1">Full Name</td>
            <td class="auto-style1">
                <asp:TextBox ID="txtFullname" runat="server" CssClass="textbox" Width="240px" Height="20px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFullname" ErrorMessage="*"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>Company</td>
            <td>
                <asp:DropDownList ID="companylst" runat="server" CssClass="textbox" Height="20px" Width="246px" DataSourceID="SqlDataSource3" DataTextField="company" DataValueField="company">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" SelectCommand="SELECT DISTINCT [company] FROM [stores]"></asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td>Department</td>
            <td>
                <asp:DropDownList ID="deptlist" runat="server" CssClass="textbox" Height="20px" Width="245px" DataSourceID="SqlDataSource2" DataTextField="department" DataValueField="department">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" SelectCommand="SELECT [department] FROM [department]"></asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server" Text="Click to Finish Registration" CssClass="button" />
            </td>
        </tr>
    </table>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" DeleteCommand="DELETE FROM [user_info] WHERE [User_key] = @User_key" InsertCommand="INSERT INTO [user_info] ([username], [company], [department], [FullName]) VALUES (@username, @company, @department, @FullName)" SelectCommand="SELECT * FROM [user_info]" UpdateCommand="UPDATE user_info SET company = @company, department = @department, FullName = @FullName WHERE (username = @username)">
            <DeleteParameters>
                <asp:Parameter Name="User_key" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:SessionParameter Name="username" SessionField="AccountName" Type="String" />
                <asp:ControlParameter ControlID="companylst" Name="company" PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="deptlist" Name="department" PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="txtFullname" Name="FullName" PropertyName="Text" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:SessionParameter Name="username" SessionField="AccountName" Type="String" />
                <asp:ControlParameter ControlID="companylst" Name="company" PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="deptlist" Name="department" PropertyName="SelectedValue" Type="String" />
                <asp:ControlParameter ControlID="txtFullname" Name="FullName" PropertyName="Text" Type="String" />
                <asp:Parameter Name="User_key" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>

    <asp:SqlDataSource ID="EngrList" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" SelectCommand="SELECT [FullName],[company],[department] FROM [user_info] WHERE ([username] = @username)" UpdateCommand="UPDATE user_info SET FullName = @FullName, company = @company, department = @department">
        <SelectParameters>
            <asp:SessionParameter Name="username" SessionField="AccountName" Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:ControlParameter ControlID="txtFullname" Name="FullName" PropertyName="Text" />
            <asp:ControlParameter ControlID="companylst" Name="company" PropertyName="SelectedValue" />
            <asp:ControlParameter ControlID="deptlist" Name="department" PropertyName="SelectedValue" />
        </UpdateParameters>
    </asp:SqlDataSource>
        </div>
</asp:Content>

<asp:Content ID="Content4" runat="server" contentplaceholderid="ErrorContent">
</asp:Content>


